﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <title>信息管理系统 - 登录</title>
    <meta name="keywords" content="信息管理系统">
    <meta name="description" content="信息管理系统">
    <link href="~/Content/Css/bootstrap.min.css" rel="stylesheet">
    <link href="~/Content/Css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="~/Content/Css/animate.css" rel="stylesheet">
    <link href="~/Content/Css/style.css" rel="stylesheet">
    <link href="~/Content/Css/login.css" rel="stylesheet">

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>
</head>
<body class="signin">
    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-7">
                <div class="signin-info">
                    <div class="logopanel m-b">
                        <h1>[ 矿工管家 ]</h1>
                    </div>
                    <div class="m-b"></div>
                    <h4>欢迎使用 <strong>矿工管家后台</strong></h4>
                    @*<ul class="m-b">
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势一</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势二</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势三</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势四</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势五</li>
                    </ul>*@

                </div>
            </div>
            <div class="col-sm-5">
                <form>
                    <h4 class="no-margins">登录：</h4>
                    <p class="m-t-md">登录到信息管理系统</p>
                    <input id="loginName" type="text" class="form-control uname" placeholder="用户名" />
                    <input id="passWord" type="password" class="form-control pword m-b" placeholder="密码" />
                    <label><input id="cbRememberMe" checked="checked" type="checkbox" value="1">&nbsp;下次自动登录</label>

                    <button type="button" id="loginBtn" class="btn btn-success btn-block">登录</button>
                </form>
            </div>
        </div>
        <div class="signup-footer">
            <div class="pull-left">
                &copy; 2017 All Rights Reserved. 矿工管家
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script type="text/javascript" src="~/Scripts/jquery.min.js?v=2.1.4"></script>
    <!-- layer javascript -->
    <script type="text/javascript" src="~/Scripts/plugins/layer/layer.min.js"></script>
    <script type="text/javascript">
        //刷新按钮
        $('#loginBtn').click(function (e) {
            $userName = $('#loginName').val();
            $passWord = $('#passWord').val();
            $rememberMe = $('#cbRememberMe').is(':checked')
            if ($userName.length == 0 || $passWord.length == 0) {
                layer.alert('账号或密码不能为空哦！', { icon: 5 });
                return;
            }

            $.ajax({
                url: "/Home/LoginAsync",
                type: "post",
                dataType: "json",
                data: {
                    name: $userName,
                    pass: $passWord,
                    remember: $rememberMe ? "1" : "0"
                },
                success: function (data) {
                    //Info,Success,Warning,Error
                    console.log(data);
                    var type = data.Type;
                    if (type == 1) {
                        var storage = window.sessionStorage;
                        storage.setItem('loginmodel', data.Data.Portrait);
                        window.location.href = "/Home/Index"

                    } else {
                        layer.msg(data.Content, { icon: 5, time: 2000 });
                    }
                }
            });
        });
    </script>
</body>
</html>
